<template>
  <div class="menucontainer">
    <el-menu
      default-active="2"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose">
      <el-menu-item index="2"  @click="toCharts">
        <i class="el-icon-s-opportunity"></i>
        <span slot="title">用户数据</span>
      </el-menu-item>
      <el-submenu index="1">
        <template slot="title">
          <i class="el-icon-coffee-cup"></i>
          <span>数据管理</span>
        </template>
        <el-menu-item-group>
          <template slot="title">人员管理</template>
          <el-menu-item index="1-1" @click="toUser">用户管理</el-menu-item>
        </el-menu-item-group>
        <el-menu-item-group>
          <template slot="title">文章管理</template>
          <el-menu-item index="1-2" @click="toBlog">博客管理</el-menu-item>
          <el-menu-item index="1-3" @click="toSecret">秘籍管理</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-menu-item index="4" @click="toPromotion">
        <i class="el-icon-setting"></i>
        <span slot="title">
          公告
        </span>
      </el-menu-item>
    </el-menu>
  </div>
</template>

<script>

export default {
    data() {
      return{

      }
    },
    methods: {
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },
      toUser(){
        this.$router.push('/admin/home/user')
      },
      toCharts(){
        this.$router.push('/admin/home/charts')
      },
      toBlog(){
        this.$router.push('/admin/home/blog')
      },
      toSecret(){
        this.$router.push('/admin/home/secret')
      },
      toPromotion(){
        this.$router.push('/admin/home/promotion')
      }
    }
  }
</script>

<style scoped>
.menucontainer{
  width: 250px;
  height: 610px;
}
</style>
